<?php
$domActiveSubmenu=str_get_html($html);

$activeSubmenu   ="";

foreach ($domActiveSubmenu->find("[com=active_submenu]")as $e)
    {
    $activeSubmenu  = $e->outertext;
    $e->outertext="";
    }

$html=$domActiveSubmenu->save();
$domActiveSubmenu->clear();
unset ($domActiveSubmenu);

if ($activeSubmenu !== "")
    {
    $str ='<?php global $uri;if ($dataSubMenu->data["_url"] == $uri) { ?>';
    $str =$str . $activeSubmenu;
    $str =$str . '<?php } else { ?>';
    $str =$str . $html;
    $str =$str . '<?php } ?>';

    $html=$str;
    }
?>